package com.g001.model;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Vector2f;
import org.newdawn.slick.state.StateBasedGame;

import com.g001.util.CachedResourceLoader;

public class Entity extends GEntity {
	
	private String name;
	protected Image image;
	
	public Entity(final String name, final String path, final Vector2f position) throws SlickException{
		this.position = position;
		this.name = name;
		image = CachedResourceLoader.getInstance().getImage(path);
		if(image == null) throw new SlickException("impossible to create this entity '"+name+"' - the resource:'"+path+"' cannot be found.");
	}

	@Override
	public void render(GameContainer container, StateBasedGame game, Graphics g)
			throws SlickException {
		g.drawImage(image, position.x, position.y);
		
	}

	@Override
	public void update(GameContainer container, StateBasedGame game, int delta)
			throws SlickException {
		// TODO Auto-generated method stub
		
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
